@extends('layouts.main')

@section('title', '添加销售办事处')

@section('content')
<h3>@yield('title')</h3>
<div class="btn-group" role="group">
  	<a href="{{ action('BaseData\SalesOfficeController@index') }}" class="btn btn-primary">返回列表</a>
</div>

<form class="form-horizontal" method="post" action="{{ action('BaseData\SalesOfficeController@store') }}">
    @csrf
    <div class="form-group">
		<label for="sales_region_code" class="col-sm-2 control-label">销售大区</label>
		<div class="col-sm-6">
			<select class="form-control" id="sales_region_code" name="sales_region_code">
				<option value="0">请选择销售大区</option>
				@foreach($sales_regions as $sales_region)
				<option value="{{ $sales_region->code }}" @if(old('sales_region_code') == $sales_region->code) selected @endif>{{ $sales_region->code_desc }}</option>
				@endforeach
			</select>
			@if($errors->first('sales_region_code'))
			<p class="help-block error">{{ $errors->first('sales_region_code') }}</p>
			@endif
		</div>
    </div>

    <div class="form-group">
		<label for="code" class="col-sm-2 control-label">销售办事处代码</label>
		<div class="col-sm-3">
			<input class="form-control" id="code" name="code" placeholder="请输入销售办事处代码" value="{{ old('code') }}">
			@if($errors->first('code'))
			<p class="help-block error">{{ $errors->first('code') }}</p>
			@endif
		</div>
    </div>

	<div class="form-group">
		<label for="code_desc" class="col-sm-2 control-label">销售办事处描述</label>
		<div class="col-sm-3">
			<input class="form-control" id="code_desc" name="code_desc" placeholder="请输入销售办事处描述" value="{{ old('code_desc') }}">
			@if($errors->first('code_desc'))
			<p class="help-block error">{{ $errors->first('code_desc') }}</p>
			@endif
		</div>
	  </div>

    <div class="form-group">
		<div class="col-sm-offset-2 col-sm-10">
			<button type="submit" class="btn btn-primary">提交</button>
		</div>
    </div>
</form>

@endsection